package com;

public class Voter {
    //投票总数，所有选民都会改变的同一个数据static
    //100，最大投票数，适用于全部的所有选民
    private static int count;
    private static final int MAX_COUNT=100;
    private String name;
    public Voter(){}
    public Voter(String name){
        this.name=name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public void voteFor(){
        if (count==MAX_COUNT){
            System.out.println("投票活动已经结束，谢谢您的参与");
            return;//非常重要，一定要写
        }else {
            count++;
            System.out.println(this.name+"感谢您的投票");
        }
    }
}
